package com.ruoyi.hqfinance.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.hqfinance.domain.HqTogetherBusinessSettleSheet;
import com.ruoyi.hqfinance.domain.vo.HqTogetherBusinessSettleSheetVo;
import com.ruoyi.hqfinance.service.HqTogetherBusinessSettleSheetService;
import com.ruoyi.logistic.domain.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/hq/togetherBusiness")
@Api(tags = "总部财务-共配业务结算报表")
public class HqTogetherBusinessSettleSheetController {
    @Autowired
    private HqTogetherBusinessSettleSheetService hqTogetherBusinessSettleSheetService;
    @ApiOperation("共配业务结算报表")
    @PostMapping("/collect")
    public R collect(@RequestBody HqTogetherBusinessSettleSheetVo vo){
        List<HqTogetherBusinessSettleSheet> togetherBusinessSettleSheets = hqTogetherBusinessSettleSheetService.togetherBusinessSettleSheet(vo);
        if (togetherBusinessSettleSheets == null || togetherBusinessSettleSheets.size() == 0) {
            return R.fail("暂无数据");
        } else {
            return R.ok(PageInfo.info(togetherBusinessSettleSheets));
        }
    }
}
